<?php

	$ColsNumber = 2;
	pushNavigationItem( getTerm('albums', 'albums') , formatUrl('/albums/') );
	pushNavigationItem( $userParam , formatUrl("/albums/$userParam/") );
	pushNavigationItem( $albumInfo['name'] , formatUrl("/albums/$userParam/$albumInfo[path]/") );
	printHeader( $albumInfo['name'] , $albumInfo['name'] , 'albums' );

?>

	<script type="text/javascript" src="/Javascript/lightbox.js"></script>
	<script type="text/javascript" src="/Javascript/scriptaculous/prototype.js"></script>
	<script type="text/javascript" src="/Javascript/scriptaculous/scriptaculous.js"></script>
	<script type="text/javascript" src="/Javascript/albumsManager.js"></script>
	<script>
		var currentUserId = <?= $albumUser['id'] ?>;
		var currentAlbumId = <?= $albumInfo['id'] ?>;
		var currentPhotoId = false;
	</script>
	
	<?php if ($hasWritePermission) { ?>

	<div class="controls">
	
		<ul>
			<li><a href="#"><a href="#" onClick="showRenameAlbumForm(<?= $albumInfo['id'] ?>);return false;">Rename this album</a></li>
			<li><a href="/Scripts/AlbumController.php?ac=deleteAlbum&id=<?= $albumInfo['id'] ?>" onClick="return confirm('<?= fill( getTerm('albums', 'confirm_delete_empty') , $alb['name'] ) ?>');">Delete this album</a></li>
		</ul>
		
	</div>
	
	<?php } ?>
	
	<div id="formBlock" style="display:none;"></div>
	
	<div id="albumDescriptionBlock">
	
		<p>
			<span id="albumDescription">
				<?= formatText( $albumInfo['description'] ) ?>
			</span>
			<?php if ($hasWritePermission) { ?>
				(<a href="#" onClick="switchDescription();return false;">Change description</a>)
			<?php } ?>
		</p>
		
	</div>
	
	<?php if ($hasWritePermission) { ?>
	
	<p id="descriptionForm" style="display:none;">
	
		<textarea name="description" id="description" rows="10" cols="50" wrap="off"><?= $albumInfo['description'] ?></textarea>
		
		<br/>
		
		<input type="button" value="Save description" onClick="saveDescription();" />
		<input type="button" value="Cancel" onClick="cancelDescription();" />
	
	</p>
	
	<?php } ?>
	
	<?php if ( ! empty($message) ) { ?>
	<div class="information">
		<?= $message ?>
	</div>
	<?php } ?>
	
	<div id="photosThumbs">
	
	<?php include('AlbumPhoto.php'); ?>
	
	</div>
	
	<?php if ($hasWritePermission) { ?>
	
	<script>
	parseDraggables(document);
	</script>
		
	<div id="newPhotoForm">
	
		<form action="<?= $_SERVER['REQUEST_URI'] ?>" method="post" enctype="multipart/form-data">
		
			<h3><?= getTerm('albums', 'share_a_photo') ?></h3>
		
			<input type="hidden" name="ac" value="uploadphoto" />
			
		<?php if ( ! empty($photoError) ) { ?>
				<div class="field error">
				<label for="photo"><?= getTerm('albums', 'photo_path') ?></label>
				<div class="error-hint"><?= $photoError ?></div>
		<?php } else { ?>
				<div class="field">
				<label for="photo"><?= getTerm('albums', 'photo_path') ?></label>
		<?php } ?>
				<input type="file" id="photo" name="photo" value="<?= $albumNameValue ?>" />
			</div>
			
			<input type="submit" value="<?= getTerm('albums', 'share_photo') ?>" />
			
		</form>
		
	</div>
	
	<?php } ?>
	
	<?php printExtra() ?>
	
	<div id="searchBox">
	
		<p>
		
			<h3>Search for photos</h3>
			
			<form action="<?= formatUrl('/albums/search.do') ?>" method="get">
			
				<input type="text" name="w" id="keywords" />
				
				<input type="hidden" name="p" value="1" />
				
				<input type="submit" value="Search" />
			
			</form>
		
		</p>
	
	</div>
	
	<div id="about-album">
	
		<h3>About <?= $albumUser['username'] ?></h3>
		
		<p><?= $albumUser['description'] ?></p>
	
	</div>
	

	<div id="albumOverview" class="flat-form">
	
		<?php include('AlbumPhotoOverview.php') ?>
		
	</div>
	
	<?php if ($hasWritePermission) { ?>
	
	<script>
	
		parseDropables(document);

	</script>
	
	<?php } ?>

	<?php 
	
	//took out google add here
	
	?>

<?php

	printFooter();

?>